//
//  EGExcelData.swift
//  EGExcel
//
//  Created by youzy01 on 2021/4/15.
//

import Foundation

/// 表格数据（String）
public struct EGExcelData {
    public var leftData: [EGExcelTableData]
    public var rightData: [EGExcelTableData]

    public init(leftData: [EGExcelTableData], rightData: [EGExcelTableData]) {
        self.leftData = leftData
        self.rightData = rightData
    }

    var rows: Int {
        let leftRows = leftData.map { $0.rows }.max() ?? 0
        let rightRows = rightData.map { $0.rows }.max() ?? 0
        let rows = max(leftRows, rightRows)
        return rows
    }
}
/// 表格数据（String）
public struct EGExcelTableData {
    public var header: TextConvertible
    public var values: [TextConvertible]

    public init(header: TextConvertible, values: [TextConvertible]) {
        self.header = header
        self.values = values
    }

    var rows: Int {
        return values.count + 1
    }
}
